home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / pgm_tool / lu62 / proc / fattlu.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  3KB  |  111 lines

  1. /*
  2.  * CopyRight 1995. Nicholas Poljakov all rights reserved.
  3.  */
  4. #include <malloc.h>
  5. #include <stdio.h>
  6. #include <dos.h>
  7. #include <attlu.h>
  8. #include <state1.h>
  9.  
  10. attachlu (lu_name,
  11.           lsl,
  12.           max_tps,
  13.           tp_exit,
  14.            n,
  15.            p_pstr,
  16.            rc,
  17.            p_lu_id)
  18.  
  19.   char lu_name[8];
  20.   int lsl ;    /*lu session limit*/
  21.   char max_tps;
  22.   unsigned   long tp_exit ;
  23.   unsigned int n;
  24.  
  25.  struct   pstr  {            /*structure partner*/
  26.  char   plu[8] ;             /* str plu_name         */
  27.  int psl;                    /* str plu_s_limit      */
  28.  char   mode_name[8] ;       /* str mode_name       */
  29.  int max_ru_size;            /* str ru_h_size       */
  30.  int pacing;                 /* str =               */
  31.  unsigned char lu_type;
  32.                     }  *p_pstr;
  33.  
  34.  unsigned long *rc;
  35.     char *p_lu_id;
  36.  
  37.          {
  38.        union REGS inregs,outregs;
  39.        struct SREGS segregs;
  40.  
  41.        struct attach_lu *ptr;
  42.        struct plu       *ptr_plu;
  43.        struct plu_mode  *ptr_mode;
  44.        char *p;
  45.        char *p1;
  46.        char *p2;
  47.        char _near *dp1;
  48.        char _near *dp2;
  49.        int i,t;
  50.        unsigned int tl,l;
  51.        char tplu[9];
  52.  
  53.        toup(lu_name);
  54.        toup(p_pstr->plu);
  55.        toup(p_pstr->mode_name);
  56.  /* system("c:\lu62\lu.exe");   */  /* Set int68 handler */
  57.        tl = n*(sizeof(struct plu) + sizeof(struct plu_mode));
  58.        l = sizeof(struct attach_lu) + tl;
  59.  
  60.        if ((ptr = (char *)calloc(1, l)) == NULL) {
  61.           *rc = PORT_BUSY; /* ¡ÑΓ ñ«ßΓπ»¡«⌐ »á¼∩Γ¿ */
  62.           return(0);
  63.        }
  64.        ptr->verb_cd=Attach_lu; /* kod primitiv */
  65.      /*  ex not used  */
  66.        copy (ptr->lu_name,lu_name,8);
  67.        ptr->lu_s_limit=lsl;
  68.        ptr->max_tps=max_tps;
  69.        ptr->tp_exit=tp_exit;
  70.        ptr->lt_plu=tl;
  71.        p2=p_pstr;
  72.        t = sizeof(struct attach_lu);
  73.        p =(char *)ptr + t;
  74.        for (i=0;i<n ;i++)  {
  75.           p=p+i*(sizeof(struct plu) + sizeof(struct plu_mode));
  76.           p1=p+sizeof(struct plu);
  77.           p2=p2+i*sizeof(struct pstr);
  78.           ptr_plu=p;
  79.           ptr_mode=p1;
  80.           p_pstr=p2;
  81.           memset(tplu,0,9);
  82.           memcpy(tplu,p_pstr->plu,8);
  83.           copy(ptr_plu->plu_name,tplu,8);
  84.           memcpy(tplu,p_pstr->mode_name,8);
  85.           copy(ptr_mode->mode_name,tplu,8);
  86.           ptr_plu->plu_s_limit=p_pstr->psl;
  87.           ptr_plu->plu_a_num = p_pstr->lu_type;
  88.           ptr_plu->rec_lt = sizeof(struct plu) + sizeof(struct plu_mode);
  89.           ptr_mode->ru_h_size=p_pstr->max_ru_size;
  90.           ptr_mode->pacing=p_pstr->pacing;
  91.        }
  92.  
  93.      dp1 = FP_OFF( ptr );
  94.      dp2 = FP_SEG( ptr );
  95.      _asm
  96.          {
  97.             push  ds
  98.             mov   dx, word ptr dp1[0]
  99.             mov   ax, word ptr dp2[0]
  100.         mov   ds, ax
  101.         mov   ax, Attach_lu
  102.             int   68h
  103.             pop   ds
  104.          }
  105.  
  106.      *rc = ptr->rc;
  107.      memcpy(p_lu_id,ptr->lu_id,8);
  108.      free(ptr);
  109.      return(0);
  110. }
  111.